<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>管理员注册</title>
<link rel="stylesheet" href="../css/booksStyle.css">
<link rel="stylesheet" href="../css/footer.css">
<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script language="javascript" type="text/javascript">
	function check() {
		var e = document.form.email.value;
		var p = document.form.phone.value;
		var reg = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
		if (!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(e)) {
			alert("请输入格式正确的 e-mail 地址！");
			return false;
		} else if (!reg.test(p)) {
			alert("请输入正确的电话格式!");
			return false;
		} else {
			return true;
		}
	}
</script>
</head>
<body>
	<jsp:include page="navbar.jsp" />
	<div class="py-5">
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<h1 class="display-1 text-center">管理员注册</h1>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="row">
				<div class="col-md-3"></div>
				<div class="col-md-6">
					<form action="register.action" method="post"
						name=" form" onsubmit="return check();">
						<div class="form-group">
							<label>账号</label> <input type="text" class="form-control"
								placeholder="账号" name="account" id="account" required="required">
							<br> <font color="red">${requestScope.registerMessage}</font>
						</div>
						<div class="form-group">
							<label>密码</label> <input type="password" class="form-control"
								placeholder="请输入密码" name="pwd1" id="pwd1" required="required">
						</div>
						<div class="form-group">
							<label>确认密码</label> <input type="password" class="form-control"
								placeholder="请再次输入密码" name="pwd2" id="pwd2" required="required">
						</div>
						<div class="form-group">
							<label>邮箱</label> <input type="text" class="form-control"
								placeholder="请输入邮箱" name="email" id="email" required="required">
						</div>
						<div class="form-group">
							<label>电话</label> <input type="text" class="form-control"
								placeholder="请输入电话" name="phone" id="phone" required="required">
						</div>
						<div class="form-group">
							<button type="submit" class="btn btn-success">注册</button>
							<input type="button" class="btn btn-primary" name="button"
								value="取消" onclick="javascript:history.go(-1)" />
						</div>
					</form>
				</div>
				<font color="red">${requestScope.errorMessage}</font>
			</div>
		</div>
	</div>

	<script type="text/javascript">
		function vaildPassword() {
			var pwd1 = document.getElementById("pwd1");
			var pwd2 = document.getElementById("pwd1");

			if (pwd1.value != pwd2.value) {
				alert("两次输入的密码不匹配");
				return false;
			} else {
				return true;
			}
		}
	</script>

</body>
</html>